/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-06-01 09:47:40
 * @LastEditTime : 2023-08-14 13:26:40
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\TwoRouter\Fence.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { OpenThrTouter, DelDataButton } from '../Common/options'

export const Fence = async ({ OptionsEvent, oneData, Permission, actionRef, ClientData }) => {
    let dataList = {
        hideInSearch: true,
        pageSize: 10,
        params: {},
        get: API_LIST([oneData.uuid])['getFencePersons'],
        options: [
            <OpenThrTouter
                title="新增人员"
                type="primary"
                icon="add"
                twoTitle="添加打卡人员"
                modal="SelectModal"
                OptionsEvent={OptionsEvent}
                other={{
                    page: 'Fence',
                    actionRef,
                    Permission,
                    twoData: oneData,
                }}
            />,
        ],
        columns: [
            commonTableList.uuid,
            {
                title: '人员id',
                dataIndex: 'userUuid',
                search: false,
                type: 'hidden',
                hideInTable: true,
            },
            { ...commonTableList.organizationUuid, valueEnum: ClientData.organization },
            {
                dataIndex: 'tableName',
                title: '姓名',
            },
            {
                title: '手机号',
                dataIndex: 'mobile',
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 160,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        <DelDataButton
                            OptionsEvent={OptionsEvent}
                            key="del"
                            way="post"
                            title="删除"
                            url="posFencePerson"
                            uuid={[oneData.uuid, record.uuid]}
                        />,
                    ]
                },
            },
        ],
    }
    return dataList
}
